home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.7 KB | 133 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWTime.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #if !defined(FWTIME_H) && !defined(__ODFRC__)
- #define FWTIME_H
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__TIME_H__)
- #include <Time.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__OSUTILS__)
- #include <OSUtils.h>
- #endif
-
- #if defined(FW_BUILD_WIN) && !defined(__TIME_H__)
- #include <Time.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Class Declarations
- //========================================================================================
- class FW_CLASS_ATTR FW_CTimeSpan;
- class FW_CLASS_ATTR FW_CString;
-
- //========================================================================================
- // FW_CTime
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CTime
- {
- public:
- enum DateForm { kShortDate, kLongDate, kAbbreviatedDate};
-
- FW_CTime();
- FW_CTime(time_t theTime);
- FW_CTime(const FW_CTime& theTime);
- FW_CTime(short year, short month, short day, short hour, short minute, short second, short dayOfWeek);
- ~FW_CTime();
-
- static FW_CTime GetCurrentTime(); // Create a new time initialized to the current time
-
- // Accessors
- time_t GetTime() const;
-
- short GetSecond() const;
- short GetMinute() const;
- short GetHour() const;
- short GetDayOfWeek() const;
- short GetDayOfMonth() const;
- short GetDayOfYear() const;
- short GetMonth() const;
- short GetYear() const;
- short IsDaylightSavings() const;
-
- void GetTimeString(FW_CString& timeString, FW_Boolean displaySeconds) const;
- void GetDateString(FW_CString& dateString, DateForm form) const;
-
- const FW_CTime& operator=(const FW_CTime& source);
- const FW_CTime& operator=(time_t source);
-
- FW_CTime operator-(FW_CTimeSpan timeSpan) const;
- FW_CTimeSpan operator-(FW_CTime time) const;
- FW_CTime operator+(FW_CTimeSpan timeSpan) const;
- const FW_CTime& operator-=(FW_CTimeSpan timeSpan);
- const FW_CTime& operator+=(FW_CTimeSpan timeSpan);
-
- FW_Boolean operator==(FW_CTime time) const;
- FW_Boolean operator!=(FW_CTime time) const;
- FW_Boolean operator<(FW_CTime time) const;
- FW_Boolean operator>(FW_CTime time) const;
- FW_Boolean operator<=(FW_CTime time) const;
- FW_Boolean operator>=(FW_CTime time) const;
-
- private:
- time_t fTime;
- };
-
- class FW_CLASS_ATTR FW_CTimeSpan
- {
- public:
- FW_CTimeSpan();
- FW_CTimeSpan(time_t theTimeSpan);
- FW_CTimeSpan(const FW_CTimeSpan& theTimeSpan);
- FW_CTimeSpan(long days, short hours, short minutes, short seconds);
- ~FW_CTimeSpan();
-
- short GetSeconds() const;
- short GetMinutes() const;
- short GetHours() const;
- long GetDays() const;
-
- long GetTotalSeconds() const;
- long GetTotalMinutes() const;
- long GetTotalHours() const;
-
- const FW_CTimeSpan& operator=(const FW_CTimeSpan& source);
- const FW_CTimeSpan& operator-=(FW_CTimeSpan timeSpan);
- const FW_CTimeSpan& operator+=(FW_CTimeSpan timeSpan);
-
- FW_CTimeSpan operator-(FW_CTimeSpan timeSpan) const;
- FW_CTimeSpan operator+(FW_CTimeSpan timeSpan) const;
-
- FW_Boolean operator==(FW_CTimeSpan timeSpan) const;
- FW_Boolean operator!=(FW_CTimeSpan timeSpan) const;
- FW_Boolean operator<(FW_CTimeSpan timeSpan) const;
- FW_Boolean operator>(FW_CTimeSpan timeSpan) const;
- FW_Boolean operator<=(FW_CTimeSpan timeSpan) const;
- FW_Boolean operator>=(FW_CTimeSpan timeSpan) const;
-
- private:
- long fTotalSeconds;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-